<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'

const activeTab = ref(0)
const router = useRouter()

const goToPlatform= () => {
  router.push('/platform')
}

const goToPolicy = () => {
  router.push('/policy')
}

const goToViolations = () => {
  router.push('/violations')
}
</script>

<template>
  <div class="top-nav">
    <div class="logo-area">
      <img src="/images/主页/u128.png" class="logo-img" />
      <span class="site-title">双碳招投标网</span>
    </div>
    <div class="nav-menu">
      <span :class="{ active: activeTab === 0 }" @click="goToPlatform">平台动态</span>
      <span :class="{ active: activeTab === 1 }" @click="goToPolicy">政策法规</span>
      <span :class="{ active: activeTab === 2 }" @click="goToViolations">违规投诉</span>
    </div>
    <div class="user-area">
      <div class="avatar">
        <img src="/images/主页/u122.png" />
      </div>
      <span class="username">admin</span>
    </div>
  </div>
</template>

<style scoped>
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  background: #fff;
  box-shadow: 0 2px 8px #f0f1f2;
  padding: 0 32px;
}
.logo-area {
  display: flex;
  align-items: center;
}
.logo-img {
  width: 32px;
  height: 32px;
  margin-right: 8px;
}
.site-title {
  font-size: 22px;
  font-weight: bold;
  color: #000000;
  letter-spacing: 2px;
}
.nav-menu span {
  margin: 0 18px;
  font-size: 16px;
  color: #333;
  cursor: pointer;
}
.nav-menu span:hover {
  color: #1abc9c;
}
.user-area {
  display: flex;
  align-items: center;
}
.avatar img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e0f7fa;
  margin-right: 8px;
}
.username {
  font-size: 15px;
  color: #666;
}
</style>